package com.cc.services.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cc.daos.PowerMapper;
import com.cc.models.Power;
import com.cc.services.PowerServiceI;

@Service("powerService")
@Transactional
public class RoleServiceImpl implements PowerServiceI{

	@Autowired
	private PowerMapper powerMapper;

	@Override
	public List<Power> findAll() {
		return powerMapper.findAll();
	}

	@Override
	public void savePower(Power power) {
		if(power.getPowerId()==0)
			powerMapper.addPower(power);
		else
			powerMapper.updatePower(power);
	}

	@Override
	public void delPower(Integer powerId) {
		powerMapper.delPower(powerId);
	}

	@Override
	public List<Power> findByPage(Map<String, Object> params) {
		return powerMapper.findByPage(params);
	}

	@Override
	public int countByParams(Map<String, Object> params) {
		return powerMapper.countByParams(params);
	}

}
